package com.ease.util.configuration {

   /**
    * Utils for easy lookup of Configurations from the shared instance of the
    * ConfigurationsManager.
    */
   public class ConfigurationUtil {
      /**
       * Returns locale.
       */
      public static function get locale():String {
         var strValue:String = getValueAsString( "locale" );
         return strValue;
      }

      /**
       * Returns the value of the Configuration matching the specified key.
       */
      private static function getValueAsString( key:String ):String {
         return ConfigurationManager.instance.getConfigurationValue( key ) as String;
      }

      /**
       * Returns the value of Configuration matching the specified key as a Boolean value.
       */
      public static function getValueAsBoolean(name:String, defaultValue:Boolean = false):Boolean {
         var queryVal:String = ConfigurationManager.instance.getConfigurationValue(name)
            as String;
         if (queryVal != null) {
            return queryVal != "false";
         }
         return defaultValue;
      }
   }
}